MaterialComponentsShadowHelper

class MaterialComponentsShadowHelper : MaterialComponentsViewInflater

A specialized AppCompatViewInflater that hooks into the layout inflation pipeline to apply the library's custom properties to selected Views.

This is not meant to be used directly, but it must be public so that the androidx appcompat framework has access. It can be applied either through resources with an XML theme attribute, or by doing the equivalent thing in code with a helper function.

For example, using an XML theme:

<style name="Theme.YourApp" parent="Theme.MaterialComponents…">

<!-- Can use the fully qualified class name instead of the @string. -->
<item name="viewInflaterClass">
@string/material_components_shadow_helper
</item>
</style>

Or, using a helper function, which simply adds the attribute setting to the current theme programmatically:

class YourActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
attachMaterialComponentsShadowHelper()
super.onCreate(savedInstanceState)

}
}

On its own, the helper looks for any tag with app:clipOutlineShadow="true". For any other selection criteria one might need, the helper can use any number of TagMatchers. Refer to its documentation for details.

Constructors

Link copied to clipboard
constructor()